package com.jiyun.controller.task;

import com.alibaba.dubbo.config.annotation.Reference;
import com.jiyun.service.goods.CategoryReportService;
import com.jiyun.service.goods.OrderService;
import org.springframework.scheduling.annotation.Scheduled;

// <bean></bean>
//@Component// 将此类，注入到spring容器中，等同于以前的配置文件
public class OrderTask {

    @Reference// 调用service的类
    OrderService orderService;

    @Scheduled(cron = "* * * * * ?")
    public void orderTimeOutLogic(){
        System.out.println("..........");
        // 查询超时订单信息
        orderService.orderTimeOutLogic();

    }

    @Reference
    private CategoryReportService categoryReportService;
    @Scheduled(cron = "0 0 1 * * ?") // 每天的凌晨1点，执行1次
    public void createCategoryReportData(){
        System.out.println("createCategoryReportData");
        categoryReportService.createData();
    }
}
